package newPan3d.content.jineng
{
	import _Pan3D.base.Object3D;
	import _Pan3D.core.Groundposition;
	import _Pan3D.display3D.Display3DContainer;
	import _Pan3D.program.Program3DManager;
	import _Pan3D.role.Npc;
	
	import _me.Scene_data;
	
	import flash.display3D.Context3D;
	import flash.display3D.Program3D;
	import flash.events.MouseEvent;
	import flash.geom.Vector3D;

	public class HuoqiuLevel
	{
		private var _context3D:Context3D;
		private var _groundItem:Array;
		private var _bulidSpriteItem:Array;
		private var _display3DContainer:Display3DContainer
		private var _zhuanQuanDispay3DSprite:HuoQiuDisplay3DSprite;
		public function HuoqiuLevel()
		{
			
			_display3DContainer=new Display3DContainer
			_context3D=Scene_data.context3D;
			addLuoye();
			Scene_data.huoqiuLevel=this;
			Scene_data.stage.addEventListener(MouseEvent.CLICK,stageClik)
		}
		
		protected function stageClik(event:MouseEvent):void
		{
			return;
			var _E:Object3D=Groundposition._getposition(Scene_data.cam3D, Scene_data.stage.mouseX - Scene_data.stage3D.x, Scene_data.stage.mouseY - Scene_data.stage3D.y);
			var beginX:int=Scene_data.focus3D.x*2
			var beginZ:int=Scene_data.focus3D.z*2

			var endX:int=Scene_data.cam3D.x + _E.x+Scene_data.focus3D.x
			var endZ:int=Scene_data.cam3D.z + _E.z+Scene_data.focus3D.z
				
			_zhuanQuanDispay3DSprite.setMoveData(new Vector3D(beginX,0,beginZ),new Vector3D(endX,0,endZ));
		}
		public function setHuoqiuLoadObj(npc:Npc):void
		{
			
		  if(Scene_data.self3DMove){
			
			  
			  var beginX:int=npc.x
			  var beginZ:int=npc.z
			var endX:int=Scene_data.self3DMove.x
			var endZ:int=Scene_data.self3DMove.z
			
			_zhuanQuanDispay3DSprite.setMoveData(new Vector3D(beginX,0,beginZ),new Vector3D(endX,0,endZ));
			
		  }
		}
		private function addLuoye():void
		{
			
			_zhuanQuanDispay3DSprite =new HuoQiuDisplay3DSprite(_context3D);
			_zhuanQuanDispay3DSprite.url ="huoqiu_mianpian128";
			_zhuanQuanDispay3DSprite.x=0
			_zhuanQuanDispay3DSprite.y=20;
			_zhuanQuanDispay3DSprite.z=0
			_zhuanQuanDispay3DSprite.scale=1;
			_display3DContainer.addChild(_zhuanQuanDispay3DSprite);
			var treeShaderProgram3d:Program3D = Program3DManager.getInstance().getProgram( HuoQiuShader.HUO_QIU_SHADER);
			_display3DContainer.setProgram3D(treeShaderProgram3d);

			
		}
		public function upData():void
		{
	
			_display3DContainer.update();
			
		}
	}
}